//坏了的计算器（medium）: https://leetcode.cn/problems/broken-calculator/
class Solution {
public:
    int brokenCalc(int startValue, int target) {
        // 正难则反 + 贪⼼
        int ret = 0;
        while (target > startValue) {
            if (target % 2 == 0)
            {
                target /= 2;
            }
            else
            {
                target += 1;
            }
            ret++;
        }
        return ret + startValue - target;
    }
};